#ifndef TIMRegister_h
#define TIMRegister_h

#include "stm32f10x.h"

void TIM_Register(TIM_TypeDef *timAddr, uint32_t freq, uint16_t counterMode,
                  int priority, int subPriority);
uint16_t TIM_GetAutoreload(TIM_TypeDef *timAddr);
void TIM_SetAutoreload(TIM_TypeDef *timAddr, uint16_t period);

uint16_t TIM_GetCounter(TIM_TypeDef *timAddr);
void TIM_SetCounter(TIM_TypeDef *timAddr, uint16_t value);

#ifdef DOWNCOUNTER_MODULE_ENABLED
void DownCounter_Config(TIM_TypeDef *timAddr);
void DownCounter_Set(uint32_t ms);

void DownCounter_Tick(void);
int TimeIsUp(void);
void DownCounter_Reset(void);
#endif

#endif